﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Master Pages/Site.Master" AutoEventWireup="true"
   CodeBehind="Registration.aspx.cs" Inherits="parkour.Web_pages.Public_Pages.Registration" %>
   <%@ MasterType virtualpath="~/Master Pages/Site.Master" %>

<asp:Content ID="HeaderContent" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
   <h2>
      Please fill out this form to register your vehicle. Once you have completed this
      form you will need to choose a parking spot, print out your registration information,
      and take it to security to get a sticker.
   </h2>

   <!-- this section contains all the fields required for all vehicles of all types -->
   <div id="general">
      <!-- get the department from the user using a dropdown list -->
      <asp:SqlDataSource ID="sqlDepartment" runat="server" ConnectionString='<%$ connectionStrings:SEI_PKConnString %>'
         SelectCommandType="StoredProcedure" SelectCommand="get_department" />
      <p>
         <asp:Label ID="DepartmentLabel" runat="server" AssociatedControlID="Department">Department:</asp:Label>
         <asp:DropDownList ID="Department" runat="server" DataSourceID="sqlDepartment" DataTextField="d_name"
            DataValueField="d_ID" AutoPostBack="true" OnSelectedIndexChanged="DepartmentChanged"/>
      </p>

      <p id="Users" runat="server" >
         <asp:Label ID="UserLabel" runat="server" AssociatedControlID="User">Register for:</asp:Label>
         <asp:TextBox ID="User" runat="server" CssClass="textEntry" />
         <asp:RequiredFieldValidator ID="UserRequired" runat="server" ControlToValidate="User"
            ValidationGroup="RegisterVehicleValidationGroup">*User ID is required.</asp:RequiredFieldValidator>
      </p>

      <!-- get the vehicle type from the user using dropdown list -->
      <asp:SqlDataSource ID="sqlVehicleType" runat="server" ConnectionString='<%$ connectionStrings:SEI_PKConnString %>' 
         SelectCommandType="StoredProcedure" />
      <p>
         <asp:Label ID="VehicleTypeLabel" runat="server" AssociatedControlID="VehicleType">Vehicle Type:</asp:Label>
         <asp:DropDownList ID="VehicleType" runat="server" DataTextField="t_name" DataSourceID="sqlVehicleType"
            DataValueField="t_ID" AutoPostBack="true" OnSelectedIndexChanged="VehicleTypeChanged" />
      </p>

      <!-- get the vehicle make from the user using a dropdown list based off of the vehicle type dropdown list -->
      <asp:SqlDataSource ID="sqlVehicleMake" runat="server" ConnectionString='<%$ connectionStrings:SEI_PKConnString %>'
         SelectCommandType="StoredProcedure" SelectCommand="get_vehicle_make" >
         <selectparameters>
            <asp:controlparameter name="type_ID" controlid="VehicleType" />
         </selectparameters>
      </asp:SqlDataSource>
      <p>
         <asp:Label ID="VehicleMakeLabel" runat="server" AssociatedControlID="VehicleMake">Vehicle Make:</asp:Label>
         <asp:DropDownList ID="VehicleMake" runat="server" DataSourceID="sqlVehicleMake" DataTextField="m_name"
            DataValueField="m_ID" AutoPostBack="true" OnSelectedIndexChanged="VehicleMakeChanged" />
      </p>

      <!-- get the vehicle model from the user using a dropdown list based off of the vehicle make dropdown list -->
      <asp:SqlDataSource ID="sqlVehicleModel" runat="server" ConnectionString='<%$ connectionStrings:SEI_PKConnString %>'
         SelectCommandType="StoredProcedure" SelectCommand="get_vehicle_model">
         <selectparameters>
            <asp:controlparameter name="make_ID" controlid="vehicleMake" />
         </selectparameters>
      </asp:SqlDataSource>
      <p>
         <asp:Label ID="VehicleModelLabel" runat="server" AssociatedControlID="VehicleModel">Vehicle Model:</asp:Label>
         <asp:DropDownList ID="VehicleModel" runat="server" DataSourceID="sqlVehicleModel" DataTextField="mo_name"
            DataValueField="mo_ID" />
      </p>
   </div>

   <!-- this section contains all the fields required for all automobiles -->
   <div id="automobile">
   
      <!-- get the color of the automobile from the user using a dropdown list -->
      <asp:SqlDataSource ID="sqlAutomobileColor" runat="server" ConnectionString='<%$ connectionStrings:SEI_PKConnString %>'
         SelectCommandType="StoredProcedure" SelectCommand="get_vehicle_color" />
      <p>
         <asp:Label ID="AutomobileColorLabel" runat="server" AssociatedControlID="AutomobileColor">Color:</asp:Label>
         <asp:DropDownList ID="AutomobileColor" runat="server" DataSourceID="sqlAutomobileColor" DataTextField="co_name"
            DataValueField="co_ID" />
      </p>

      <!-- get the year of the automobile from the user using a text field -->
      <p>
         <asp:Label ID="AutomobileYearLabel" runat="server" AssociatedControlID="AutomobileYear">Automobile year:</asp:Label>
         <asp:TextBox ID="AutomobileYear" runat="server" CssClass="textEntry" />
         <asp:RequiredFieldValidator ID="AutomobileYearRequired" runat="server" ControlToValidate="AutomobileYear"
            ValidationGroup="RegisterVehicleValidationGroup">*Automobile year is required.</asp:RequiredFieldValidator>
      </p>

      <!-- get the license_number from the user using a text field -->
      <p>
         <asp:Label ID="LicenseNumberLabel" runat="server" AssociatedControlID="LicenseNumber">License number:</asp:Label>
         <asp:TextBox ID="LicenseNumber" runat="server" CssClass="textEntry" />
         <asp:RequiredFieldValidator ID="LicenseNumberRequired" runat="server" ControlToValidate="LicenseNumber"
            ValidationGroup="RegisterVehicleValidationGroup">*License number is required.</asp:RequiredFieldValidator>
      </p>
      
      <!-- get the state of registration of the automobile from the user using a dropdown list -->
      <asp:SqlDataSource ID="sqlRegistrationState" runat="server" ConnectionString='<%$ connectionStrings:SEI_PKConnString %>'
         SelectCommandType="StoredProcedure" SelectCommand="get_registration_state" />
      <p>
         <asp:Label ID="RegistrationStateLabel" runat="server" AssociatedControlID="RegistrationState">Registration state:</asp:Label>
         <asp:DropDownList ID="RegistrationState" runat="server" DataSourceID="sqlRegistrationState" DataTextField="r_s_name"
            DataValueField="r_s_ID" />
      </p>

      <!-- get the insurance company from the user using a dropdown list -->
      <asp:SqlDataSource ID="sqlInsurance" runat="server" ConnectionString='<%$ connectionStrings:SEI_PKConnString %>'
         SelectCommandType="StoredProcedure" SelectCommand="get_insurance" />
      <p>
         <asp:Label ID="InsuranceLabel" runat="server" AssociatedControlID="Insurance">Insurance company:</asp:Label>
         <asp:DropDownList ID="Insurance" runat="server" DataSourceID="sqlInsurance" DataTextField="i_name"
            DataValueField="i_ID" />
      </p>

      <!-- get the automobile size from the user using a dropdown list -->
      <asp:SqlDataSource ID="sqlAutomobileSize" runat="server" ConnectionString='<%$ connectionStrings:SEI_PKConnString %>'
         SelectCommandType="StoredProcedure" SelectCommand="get_automobile_size" />
      <p>
         <asp:Label ID="AutomobileSizeLabel" runat="server" AssociatedControlID="Insurance">Automobile size:</asp:Label>
         <asp:DropDownList ID="AutomobileSize" runat="server" DataSourceID="sqlAutomobileSize" DataTextField="a_s_name"
            DataValueField="a_s_ID" />
      </p>

      <!-- get the number of seatbelts from the user using a text field -->
      <p>
         <asp:Label ID="NumberSeatbeltsLabel" runat="server" AssociatedControlID="NumberSeatbelts">Number of seatbelts:</asp:Label>
         <asp:TextBox ID="NumberSeatbelts" runat="server" CssClass="textEntry" />
         <asp:RequiredFieldValidator ID="NumberSeatbeltsRequired" runat="server" ControlToValidate="NumberSeatbelts"
            ValidationGroup="RegisterVehicleValidationGroup">*Number of seatbelts is required.</asp:RequiredFieldValidator>
      </p>
   </div>


   <div id="motorcycle">

      <!--
      vehicle_ID (done in database)
      color (done on this page)
      year (done on this page)
      license_number (done on this page)
      registration_state (done on this page --should there be a table in the database with a list of the states?--)
      insurance_ID (done on this page)
      -->
   </div>


   <div id="bicycle">
      <!--
      vehicle_ID (done in database)
      color (done on this page)
      -->
   </div>


   <div id="golfCart">
      <!--
      vehicle_ID (done in database)
      -->
   </div>


   <div id="segway">
      <!--
      vehicle_ID (done in database)
      -->
   </div>

   <p class="submitButton">
      <asp:Button ID="Next" runat="server" CommandName="Next" Text="Next" 
         ValidationGroup="RegisterVehicleValidationGroup" onclick="Next_Click" />
   </p>
</asp:Content>
